home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form3
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "Example 3: Diagrams"
- ClientHeight = 3765
- ClientLeft = 1095
- ClientTop = 1485
- ClientWidth = 5445
- FillColor = &H0000FFFF&
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 0
- weight = 700
- size = 8.25
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- ForeColor = &H80000008&
- Height = 4170
- Left = 1035
- LinkTopic = "Form3"
- MDIChild = -1 'True
- ScaleHeight = 3765
- ScaleWidth = 5445
- Tag = "3"
- Top = 1140
- Width = 5565
- Begin EasynetLib.Easynet Net1
- Height = 3465
- Left = 150
- TabIndex = 0
- Top = 120
- Width = 4665
- _Version = 65538
- _ExtentX = 8229
- _ExtentY = 6112
- _StockProps = 101
- BackColor = 16777088
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- name = "MS Sans Serif"
- charset = 0
- weight = 400
- size = 8.25
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- BorderStyle = 1
- xGrid = 11
- yGrid = 11
- Shape = 0
- FillColor = 16777215
- DrawColor = 255
- ForeColor = 0
- DrawWidth = 1
- Oriented = -1 'True
- ReadOnly = 0 'False
- MultiSel = -1 'True
- ScrollBars = 3
- CanDrawNode = -1 'True
- CanDrawLink = -1 'True
- CanMoveNode = -1 'True
- CanSizeNode = -1 'True
- CanStretchLink = -1 'True
- CanMultiLink = -1 'True
- Transparent = 0 'False
- DrawStyle = 6
- Alignment = 7
- ShowGrid = -1 'True
- LinkHead = 0
- DoSelChange = -1 'True
- DoAddNode = -1 'True
- DoAddLink = -1 'True
- Hiding = 0 'False
- ImageFile = ""
- DisplayHandles = -1 'True
- Zoom = 100
- AutoSize = 0
- AutoScroll = -1 'True
- End
- Attribute VB_Name = "Form3"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Option Explicit
- Dim n%, flag%
- Dim Node(1 To 4) As Long
- Dim X0&, Y0&
- Private Sub banner3()
- With Net1
- .AddNodeItem
- .X1 = 600
- .Y1 = 200
- .X2 = .X1 + 500
- .Y2 = .Y1 + 500
- .Transparent = False
- Node(1) = .item
- .AddNodeItem
- .X1 = 2100
- .Y1 = 200
- .X2 = .X1 + 500
- .Y2 = .Y1 + 500
- Node(2) = .item
- .AddNodeItem
- .X1 = 1600
- .Y1 = 1700
- .X2 = .X1 + 500
- .Y2 = .Y1 + 500
- Node(3) = .item
- .AddNodeItem
- .X1 = 100
- .Y1 = 1700
- .X2 = .X1 + 500
- .Y2 = .Y1 + 500
- Node(4) = .item
- .AddLinkItem Node(1), Node(2)
- .AddLinkItem Node(2), Node(3)
- .AddLinkItem Node(3), Node(4)
- .AddLinkItem Node(1), Node(4)
- .AddLinkItem Node(1), Node(3)
- .item = 0
- End With
- End Sub
- Private Sub Form_Activate()
- ActivateForm
- End Sub
- Private Sub Form_Deactivate()
- DeactivateForm
- End Sub
- Private Sub Form_Load()
- MDI1.ShowExample(2).Enabled = False
- n = 1
- flag = False
- Net1.Left = 0
- Net1.Top = 0
- SpeedON Net1
- banner3
- SpeedOFF Net1
- End Sub
- Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
- CursorShape Net1
- End Sub
- Private Sub Form_Resize()
- If WindowState <> 1 And ScaleHeight <> 0 Then
- Net1.Height = ScaleHeight
- Net1.Width = ScaleWidth
- End If
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- MDI1.ShowExample(2).Enabled = True
- MDI1.Command5.Enabled = False
- MDI1.Command5.Caption = "Comments "
- End Sub
- Private Sub Net1_AddLink()
- If flag = True Then
- flag = False
- End If
- End Sub
- Private Sub Net1_AddNode()
- ' Avoid too small nodes
- If Net1.X2 - Net1.X1 < 500 Then Net1.X2 = Net1.X1 + 500
- If Net1.Y2 - Net1.Y1 < 500 Then Net1.Y2 = Net1.Y1 + 500
- Net1.Text = Str(n)
- n = n + 1
- End Sub
- Private Sub Net1_KeyDown(KeyCode As Integer, Shift As Integer)
- If KeyCode = KEY_DELETE Then
- Net1.DeleteSel
- End If
- End Sub
- Private Sub Net1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
- If Net1.PointedArea = 5 Then
- flag = True
- X0 = X
- Y0 = Y
- End If
- End Sub
- Private Sub Net1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
- CursorShape Net1
- End Sub
- Private Sub Net1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
- Dim Xabs, Yabs As Single
- Dim org&, dst&
- If flag = True Then
- flag = False
- If (Abs(X - X0) < 300 And Abs(Y - Y0) < 300) Then
- Exit Sub
- End If
- ' Origin node of next created link
- org = Net1.item
- ' No current item
- Net1.item = 0
- Xabs = X + Net1.xScroll
- Yabs = Y + Net1.yScroll
- ' Create destination node
- Net1.X1 = Xabs - 300
- Net1.X2 = Xabs + 300
- Net1.Y1 = Yabs - 300
- Net1.Y2 = Yabs + 300
- Net1.AddNodeItem
- ' Destination node of next created link
- dst = Net1.item
- ' Create link
- Net1.AddLinkItem org, dst
- End If
- End Sub
-